﻿using MediatR;
using Product.Domain;
using Product.Infrstructre.Impl;
using Product.Read.API.Applcation.Command;

namespace Product.Read.API.Applcation.CommandHandlers
{
    /// <summary>
    /// 产品反填
    /// </summary>
    public class ProductInfoSetCommandHandler : IRequestHandler<ProductInfoSetCommand, Products>
    {
        protected readonly IbaseProductInfoRepository _baseProductInfoRepository;

        public ProductInfoSetCommandHandler(IbaseProductInfoRepository baseProductInfoRepository)
        {
            _baseProductInfoRepository = baseProductInfoRepository;
        }

        public async Task<Products> Handle(ProductInfoSetCommand request, CancellationToken cancellationToken)
        {
            return await _baseProductInfoRepository.GetAllByIdAsync(request.id);
        }
    }
}
